from stack import  Stack


def ten_to_two(number):
    s = Stack()

    while number > 0:
        rem = number % 2
        s.push(rem)
        number = number // 2

    bin_string = ''
    while not s.is_empty():
        bin_string += str(s.pop())

    return bin_string


def ten_to_x(num, x):
    s = Stack()

    while num > 0:
        rem = num % x
        s.push(rem)
        num = num // x

    x_sting = ''
    while not s.is_empty():
        x_sting += str(s.pop())

    return x_sting


def test(num, x):
    dights = '0123456789ABCDEF'
    s = Stack()

    while num > 0:
        rem = num % x
        s.push(rem)
        num = num // x

    x_sting = ''
    while not s.is_empty():
        x_sting += dights[s.pop()]

    return x_sting


if __name__ == "__main__":
    num = 233
    print(bin(233))
    print(test(233, 2))

    print(oct(num))
    print(test(num, 8))

    print(hex(num))
    print(test(num, 16))